package com.easyfun.healthmagicbox.comm.json;

import java.util.ArrayList;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.easyfun.healthmagicbox.pojo.DoctorAndSuggestion;
import com.easyfun.healthmagicbox.pojo.DoctorProfile;
import com.easyfun.healthmagicbox.pojo.HealthInputData;
import com.easyfun.healthmagicbox.pojo.PersonProfile;
import com.easyfun.healthmagicbox.pojo.PersonQuestion;

public class DoctorProfileJsonWrapper<T extends JsonWrapper,E> 
		extends AbstractJsonWrapper<T,DoctorProfile>{
	

	public DoctorProfileJsonWrapper(DoctorProfile pp)
	{
		mpp = pp;
	}

    public DoctorProfileJsonWrapper()  {
    }    
 
    public DoctorProfile getMpp() {
		return mpp;
	}
 
    public void deserializeFromObj(JSONObject obj) throws JSONException {

    	if (mpp == null) {
			mpp = new DoctorProfile();
		}
    	mpp.setDoctorAge(obj.getString("doctorAge"));

    	mpp.setDoctorID(obj.getString("doctorID"));
    	mpp.setDoctorIntroduction(obj.getString("doctorIntroduction"));
    	mpp.setDoctorHospital(obj.getString("doctorHospital"));
    	mpp.setDoctorName(obj.getString("doctorName"));
    	mpp.setDoctorPictureFile(obj.getString("doctorPictureFile"));
    	mpp.setDoctorSex(obj.getString("doctorSex"));
    	mpp.setDoctorShortIntro(obj.getString("doctorShortIntro"));
    	mpp.setDoctorDepartment(obj.getString("doctorDepartment"));
    }
 
    public String serialize() throws JSONException {
        return serializeToObj().toString();
    }
 
    public JSONObject serializeToObj() throws JSONException {
        JSONObject serializedObj = new JSONObject();
        serializedObj.put("doctorAge", mpp.getDoctorAge());
        serializedObj.put("doctorID", mpp.getDoctorID());
        serializedObj.put("doctorIntroduction", mpp.getDoctorIntroduction());
        serializedObj.put("doctorHospital", mpp.getDoctorHospital());
        serializedObj.put("doctorName", mpp.getDoctorName());
        serializedObj.put("doctorPictureFile", mpp.getDoctorPictureFile());
        serializedObj.put("doctorSex", mpp.getDoctorSex());
        serializedObj.put("doctorShortIntro", mpp.getDoctorShortIntro());
        serializedObj.put("doctorDepartment", mpp.getDoctorDepartment());
 
        return serializedObj;
    }
    
   
}
